|
|
|
|
|
|
|
The routine then uses NearestPoint to locate the data value nearest to each of the points in the grid. It sets the grid value equal to that data point's Y value. |
|
|
|
 |
|
|
|
|
' Create the grid values for display.
'
' Dx and Dz tell how far apart to make the grid
' lines. Public Sub InitializeGrid(ByVal Dx As Single, _
ByVal Dz As Single)
Dim Xmin As Single
Dim Xmax As Single
Dim Zmin As Single
Dim Zmax As Single
Dim NumX As Integer
Dim NumZ As Integer
Dim wid As Single
Dim hgt As Single
Dim i As Integer
Dim j As Integer
Dim X As Single
Dim Y As Single
Dim Z As Single
Dim best_i As Integer
' Find the X and Z data bounds. Xmin = Data(1).coord(1)
Xmax = Xmin
Zmin = Data(1).coord(3)
Zmax = Zmin
For i = 2 To NumPts
If Xmin > Data(i).coord(1) Then _
Xmin = Data(i).coord(1)
If Xmax < Data(i).coord(1) Then _
Xmax = Data(i).coord(1)
If Zmin > Data(i).coord(3) Then _
Zmin = Data(i).coord(3)
If Zmax < Data(i).coord(3) Then _
Zmax = Data(i).coord(3)
Next i
' Set the data boundaries. wid = Xmax - Xmin
hgt = Zmax - Zmin
NumX = wid / Dx + 1
NumZ = hgt / Dz + 1
X = (wid - NumX * Dx) / 2
Z = (hgt - NumZ * Dz) / 2
Xmin = Xmin - X
Xmax = Xmax + X
Zmin = Zmin - Z
Zmax = Zmax + Z |
|
|
|
|
|